#include <iostream>
using std::cout;
using std::endl;

class Point{
private:
    //私有化构造函数，确保只有一个对象
    Point()
    {
    }
public:
    //定义一个可以向外界暴露对象的函数
    static Point & getInstance(){
        static Point s;
        cout << "static:" << &s << endl;
        return s;
    }
    Point(const Point & rhs)=delete;//拷贝构造函数，本质也是构造函数
    Point & operator=(const Point &rhs)=delete;//赋值运算符函数
};
void test(){
    Point & s1 = Point::getInstance();
    Point & s2 = Point::getInstance();
    cout << &s1 << endl;
    cout << &s2 << endl;
}
int main()
{
    test();
    return 0;
}

